package com.jgybzx.mapper;

import com.jgybzx.entity.User;
import com.jgybzx.entity.UserExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Jgybzx
 * @date 2021/7/30 14:21
 * des
 */
@Component
public interface UserMapper {
    /**
     * countByExample
     *
     * @param example
     * @return long
     * @author jgybzx
     * @date 2021/8/9 19:14
     */
    long countByExample(UserExample example);

    /**
     * deleteByExample
     *
     * @param example
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:14
     */
    int deleteByExample(UserExample example);

    /**
     * deleteByPrimaryKey
     *
     * @param userId
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int deleteByPrimaryKey(Integer userId);

    /**
     * insert
     *
     * @param record
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int insert(User record);

    /**
     * insertSelective
     *
     * @param record
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int insertSelective(User record);

    /**
     * selectByExample
     *
     * @param example
     * @return java.util.List<com.jgybzx.entity.User>
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    List<User> selectByExample(UserExample example);

    /**
     * selectByPrimaryKey
     *
     * @param userId
     * @return com.jgybzx.entity.User
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    User selectByPrimaryKey(Integer userId);

    /**
     * updateByExampleSelective
     *
     * @param record
     * @param example
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    /**
     * updateByExampleSelective
     *
     * @param record
     * @param example
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    /**
     * updateByExampleSelective
     *
     * @param record
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int updateByPrimaryKeySelective(User record);

    /**
     * updateByExampleSelective
     *
     * @param record
     * @return int
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    int updateByPrimaryKey(User record);

    /**
     * queryUserAndRole
     *
     * @return java.util.List<com.jgybzx.entity.User>
     * @author jgybzx
     * @date 2021/8/9 19:15
     */
    List<User> queryUserAndRole();

    /**
     * 三级嵌套查询
     *
     * @param userId
     * @return com.jgybzx.entity.User
     * @author jgybzx
     * @date 2021/8/9 19:16
     */
    User queryUserAndRoleAndPermission(Integer userId);

    /**
     * 根据用户名和密码查询用户
     *
     * @param userName
     * @return com.jgybzx.entity.User
     * @author jgybzx
     * @date 2021/8/2 9:52
     */
    User queryUserByUserName(@Param("userName") String userName);
}